@extends('layouts.default')
@section('content') 
@foreach ($values as $v) 
<div class="box">
    <header>
        <div class="icons">
            <i class="fa fa-list"></i>
        </div>
        <h5>{{ Lang::get('messages.vehicle_info')}}</h5>
        <div class="toolbar">  
            {{ Helpers\Helper::fa_link_to_action('glyphicon glyphicon-plus',
                            'CarController@create',
                            Lang::get('messages.add_btn'),null,array(
                            'class'=>'btn btn-success btn-sm btn-round'))
            }}        
            {{ Helpers\Helper::fa_link_to_action('glyphicon glyphicon-pencil',
                    'CarController@edit',Lang::get('messages.edit_btn'),$v->id, array( 
                            'class'=>'btn btn-success btn-sm btn-round')) 
            }}   
        </div>
    </header>
    <div class="body">
        <h3><div class="label label-success" >{{ $v->Description }}</div></h3><br/>
        <ul>
            <table>
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.make')}}</li></td>               
                <td class="text-success" style="padding-left:8em">{{ $v->Make }}</td>
                <td rowspan="10" style="padding-left:8em">    
                    <img class="ri images" src="{{ 
                            isset($image)?$image: URL::to('assets/img/no_images.jpg') }}"/></td>
                </tr>
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.model')}}</li></td>                
                <td class="text-success" style="padding-left:8em">{{ $v->Model }}</td>
                </tr>
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.license')}}</li></td>               
                <td class="text-success" style="padding-left:8em">{{ $v->License }}</td>
                </tr>
                @foreach ($class as $c)
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.class')}}</li></td>               
                <td class="text-success" style="padding-left:8em">{{ $c->class }}</td>
                </tr>
                                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.status')}}</li></td>               
                <td class="text-success" style="padding-left:8em">
                    @if($v->status == 0 )
                    {{ Lang::get('messages.sold')}}
                    @else
                    {{ Lang::get('messages.in_fleet')}}
                    @endif
                </td>
                </tr>
                @endforeach
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.milage')}}</li></td>
                <td class="text-success" style="padding-left:8em">{{ $v->Milage }}</td>
                </tr>
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.year')}}</li></td>
                <td class="text-success" style="padding-left:8em">{{ $v->year }}</td>
                </tr>                    
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.color')}}</li></td>
                <td class="text-success" style="padding-left:8em">{{ $v->Color }}</td>
                </tr>
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.vin')}}</li></td>
                <td class="text-success" style="padding-left:8em">{{ $v->vin }}</td>
                </tr>   
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.fuel')}}</li></td>
                <td class="text-success" style="padding-left:8em">{{ $v->fuel }}</td>
                </tr>
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.transmission')}}</li></td>
                <td class="text-success" style="padding-left:8em">{{ $v->trans }}</td>
                </tr>
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.air_condition')}}</li></td>
                <td class="text-success" style="padding-left:8em">
                    @if( $v->air_condition == 1 )
                    {{ Lang::get('messages.yes')}}
                    @else
                    {{ Lang::get('messages.no')}}
                    @endif
                </td>
                </tr> 

                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.nr_people')}}</li></td>
                <td class="text-success" style="padding-left:8em">{{ $v->nr_people}}</td>
                </tr> 
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.nr_suitcase')}}</li></td>
                <td class="text-success" style="padding-left:8em">{{ $v->nr_suitcase }}</td>
                </tr> 
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.nr_doors')}} </li></td>
                <td class="text-success" style="padding-left:8em">{{ $v->nr_doors }}</td>
                </tr>
                @if(strtotime($v->sgs)!= 0000-00-00)
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.sgs')}}</li></td>
                @if( Helpers\Helper::status($v->sgs, $date, $limit_date) == 1)  
                <td class="text-success" style="padding-left:8em">
                    <i class="fa fa-check-circle fa-lg" style="color:#42b142" title="{{ Lang::get('messages.success_tltp') }}"></i>
                </td>
                @elseif ( Helpers\Helper::status($v->sgs, $date, $limit_date) == 5) 
                <td class="text-success" style="padding-left:8em">
                    <i class="fa fa-exclamation-circle fa-lg" style="color:#ec971f" title="{{ Lang::get('messages.warning_tltp').' '.$v->sgs }}"></i>
                </td>
                @elseif (Helpers\Helper::status($v->sgs, $date, $limit_date) == 21) 
                <td class="text-success" style="padding-left:8em">
                    <i class="fa fa-exclamation-circle fa-lg" style="color:#c00" title="{{ Lang::get('messages.danger_tltp') }}"></i>
                </td>
                @else
                <i class="fa fa-info-circle fa-lg" style="color:#006dcc" 
                           title="{{Lang::get('messages.empty_status_tltp') }}"></i>
                @endif
                </tr>
                @else
                @endif
                @if(strtotime($v->tpl)!= 0000-00-00) 
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.tpl')}}</li></td>
                @if( Helpers\Helper::status($v->tpl, $date, $limit_date) == 1)  
                <td class="text-success" style="padding-left:8em">
                    <i class="fa fa-check-circle fa-lg" style="color:#42b142" title="{{ Lang::get('messages.success_tltp') }}"></i>
                </td>
                @elseif ( Helpers\Helper::status($v->tpl, $date, $limit_date) == 5) 
                <td class="text-success" style="padding-left:8em">
                     <i class="fa fa-exclamation-circle fa-lg" style="color:#ec971f" title="{{ Lang::get('messages.warning_tltp').' '.$v->tpl}}"></i>
                </td>
                @elseif ( Helpers\Helper::status($v->tpl, $date, $limit_date) == 21)  
                <td class="text-success" style="padding-left:8em">
                    <i class="fa fa-exclamation-circle fa-lg" style="color:#c00" title="{{ Lang::get('messages.danger_tltp') }}"></i>

                </td>
                @endif
                </tr>
                @else
                @endif
                @if(strtotime($v->kasko)!= 0000-00-00) 
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.kasko')}}</li></td>
                @if( Helpers\Helper::status($v->kasko, $date, $limit_date) == 1)  
                <td class="text-success" style="padding-left:8em">
                    <i class="fa fa-check-circle fa-lg" style="color:#42b142" title="{{ Lang::get('messages.success_tltp') }}"></i>
                </td>
                @elseif ( Helpers\Helper::status($v->kasko, $date, $limit_date) == 5) 
                <td class="text-success" style="padding-left:8em">
                    <i class="fa fa-exclamation-circle fa-lg" style="color:#ec971f" title="{{ Lang::get('messages.warning_tltp').' '.$v->kasko}}"></i>
                </td>
                @elseif ( Helpers\Helper::status($v->kasko, $date, $limit_date) == 21) 
                <td class="text-success" style="padding-left:8em">
                     <i class="fa fa-exclamation-circle fa-lg" style="color:#c00" title="{{ Lang::get('messages.danger_tltp') }}"></i>
                </td>
                @endif
                </tr>
                @else
                @endif
                @if(strtotime($v->inter_permis)!= 0000-00-00) 
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.inter_permission')}}</li></td>
                @if( Helpers\Helper::status($v->inter_permis, $date, $limit_date) == 1)  
                <td class="text-success" style="padding-left:8em">
                     <i class="fa fa-check-circle fa-lg" style="color:#42b142" title="{{ Lang::get('messages.success_tltp') }}"></i>
                </td>
                @elseif ( Helpers\Helper::status($v->inter_permis, $date, $limit_date) == 5) 
                <td class="text-success" style="padding-left:8em">
                    <i class="fa fa-exclamation-circle fa-lg" style="color:#ec971f" title="{{ Lang::get('messages.warning_tltp').' '.$v->inter_permis}}"></i>
                </td>
                @elseif ( Helpers\Helper::status($v->inter_permis, $date, $limit_date) == 21) 
                <td class="text-success" style="padding-left:8em">
                    <i class="fa fa-exclamation-circle fa-lg" style="color:#c00" title="{{ Lang::get('messages.danger_tltp') }}"></i>
                </td>
                @endif
                </tr>
                @else
                @endif 
                @if(!empty($maintenance_status))
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.maintenance_status')}}</li></td>                
                <td class="text-success" style="padding-left:8em">
                    @foreach($maintenance_status as $m)
                    @if(
                    ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 1) 
                    && (Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) <= 4))
                    && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 1)
                    && (Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) <= 4))
                    )  
                    <?php $counter += 1; ?>
                    @elseif(
                    ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 1) 
                    && (Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) <= 4))
                    && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 5) 
                    && (Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) <= 20))
                    )  
                    <?php $counter += 17; ?>
                    @elseif (
                    ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 5) 
                    && (Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) <= 20))
                    && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 1) 
                    && (Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) <= 4))
                    )
                    <?php $counter += 17; ?>
                    @elseif (
                    ((Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) >= 5) 
                    && (Helpers\Helper::status_maintenance($m->milage, $m->km_due, $m->maint_milage) <= 20))
                    && ((Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) >= 5) 
                    && (Helpers\Helper::status_date($current_date, $m->month_due, $m->maintenance_date) <= 20))
                    )
                    <?php $counter += 17; ?>
                    @else 
                    <?php $counter += 273; ?>
                    @endif 
                    @endforeach
                    @if($counter >=273)
                     <i class="fa fa-exclamation-circle fa-lg" style="color:#c00" title="{{ Lang::get('messages.danger_tltp') }}"></i>
                                               
                    @elseif($counter >= 17 && $counter <= 272) 
                     <i class="fa fa-exclamation-circle fa-lg" style="color:#ec971f" title="{{ Lang::get('messages.warning_tltp')}}"></i>
                                               
                    @elseif($counter >= 1 && $counter <= 16)
                    <i class="fa fa-check-circle fa-lg" style="color:#42b142" title="{{ Lang::get('messages.success_tltp') }}"></i>
                    @else
                    <i class="fa fa-info-circle fa-lg" style="color:#006dcc" 
                           title="{{Lang::get('messages.empty_status_tltp') }}"></i>
                                     
                    @endif    
                </td>
                </tr>
                @endif
                @if(!empty($owner_cert_filename))
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.owner_cert_doc')}}</li></td>                
                <td class="text-success" style="padding-left:8em">{{link_to_action('CarController@download_ownerCertDoc', 
                            $owner_cert_filename, array('id'=>$v->id))}}</td>
                <td style="padding-left:8em" > {{ Helpers\Helper::fa_link_to_action(
                                    '',
                                    'CarController@destroy_ownerCert',
                                    'x',
                                     $v->insur_docs_id, array( 
                                    'class'=>'btn btn-danger btn-xs btn-circle btn-line delete',
                                    'id'=>'delete-owner',
                                    'data-confirm'=>Lang::get('messages.confirm_delete'))) 
                    }}
                </td>
                </tr>
                @endif
                @if(!empty($sgs_filename))
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.sgs_doc')}}</li></td>                
                <td class="text-success" style="padding-left:8em">{{link_to_action('CarController@download_sgsDoc', 
                            $sgs_filename, array('id'=>$v->id))}}</td>
                <td style="padding-left:8em" > {{ Helpers\Helper::fa_link_to_action(
                                    '',
                                    'CarController@destroy_sgs',
                                    'x',
                                     $v->insur_docs_id, array( 
                                    'class'=>'btn btn-danger btn-xs btn-circle btn-line delete',
                                    'id'=>'delete-owner',
                                    'data-confirm'=>Lang::get('messages.confirm_delete')
                            )) 
                    }}
                </td>
                </tr>
                @endif
                @if(!empty($tpl_filename))
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.tpl_doc')}}</li></td>                
                <td class="text-success" style="padding-left:8em">{{link_to_action('CarController@download_tplDoc', 
                            $tpl_filename, array('id'=>$v->id))}}</td>
                <td style="padding-left:8em" > {{ Helpers\Helper::fa_link_to_action(
                                    '',
                                    'CarController@destroy_tpl',
                                    'x',
                                     $v->insur_docs_id, array( 
                                    'class'=>'btn btn-danger btn-xs btn-circle btn-line delete',
                                    'id'=>'delete-owner',
                                    'data-confirm'=>Lang::get('messages.confirm_delete'))) 
                    }}
                </td>
                </tr>
                @endif
                @if(!empty($kasko_filename))
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.kasko_doc')}}</li></td>                
                <td class="text-success" style="padding-left:8em">{{link_to_action('CarController@download_kaskoDoc', 
                            $kasko_filename, array('id'=>$v->id))}}</td>
                <td style="padding-left:8em" > {{ Helpers\Helper::fa_link_to_action(
                                    '',
                                    'CarController@destroy_kasko',
                                    'x',
                                     $v->insur_docs_id, array( 
                                    'class'=>'btn btn-danger btn-xs btn-circle btn-line delete',
                                    'id'=>'delete-owner',
                                    'data-confirm'=>Lang::get('messages.confirm_delete'))) 
                    }}
                </td>
                </tr>
                @endif
                @if(!empty($drive_permis_filename))
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.drive_permis_doc')}}</li></td>                
                <td class="text-success" style="padding-left:8em">{{link_to_action('CarController@download_drivePermisDoc', 
                            $drive_permis_filename, array('id'=>$v->id))}}</td>
                <td style="padding-left:8em" > {{ Helpers\Helper::fa_link_to_action(
                                    '',
                                    'CarController@destroy_drivePermis',
                                    'x',
                                     $v->insur_docs_id, array( 
                                    'class'=>'btn btn-danger btn-xs btn-circle btn-line delete',
                                    'id'=>'delete-owner',
                                    'data-confirm'=>Lang::get('messages.confirm_delete'))) 
                    }}
                </td>
                </tr>
                @endif
                @if(!empty($inter_permis_filename))
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.inter_permis_doc')}}</li></td>                
                <td class="text-success" style="padding-left:8em">{{link_to_action('CarController@download_interPermisDoc', 
                            $inter_permis_filename, array('id'=>$v->id))}}</td>
                <td style="padding-left:8em" > {{ Helpers\Helper::fa_link_to_action(
                                    '',
                                    'CarController@destroy_interPermis',
                                    'x',
                                     $v->insur_docs_id, array( 
                                    'class'=>'btn btn-danger btn-xs btn-circle btn-line delete',
                                    'id'=>'delete-owner',
                                    'data-confirm'=>Lang::get('messages.confirm_delete'))) 
                    }}
                </td>
                </tr>
                @endif
                @if(!empty($authoriz_filename))
                <tr>
                    <td><li class="badge badge-success">{{ Lang::get('messages.authoriz_doc')}}</li></td>                
                <td class="text-success" style="padding-left:8em">{{link_to_action('CarController@download_authorizDoc', 
                            $authoriz_filename, array('id'=>$v->id))}}</td>
                <td style="padding-left:8em" > {{ Helpers\Helper::fa_link_to_action(
                                    '',
                                    'CarController@destroy_authoriz',
                                    'x',
                                     $v->insur_docs_id, array( 
                                    'class'=>'btn btn-danger btn-xs btn-round delete',
                                    'id'=>'delete-owner',
                                    'data-confirm'=>Lang::get('messages.confirm_delete'))) 
                    }}
                </td>
                </tr>
                @endif
            </table>
              {{  Helpers\Helper::modal(Lang::get('messages.modal_confirm'),Lang::get("messages.close_btn"),Lang::get("messages.ok_btn"),'dataConfirmOK')}}
        </ul>               
    </div>
</div>

    <div class="box">
        <header>
            <div class="icons">
                <i class="fa fa-list"></i>
            </div>
            <h5>{{Lang::get('messages.other_options')}}</h5>
            <div class="toolbar">
                <span class="label label-default">
                    <i class="fa fa-list-alt"></i>
                </span> 
            </div>
        </header>
        <div class="body">
            <ul>
                <table>
                    <tr>
                        <td><li class="text-primary">{{link_to_action('Insur_DocController@edit', 
                            Lang::get('messages.insur_docs'), array('id'=>$v->id))}}</li><br/></td>    
                    <td style="padding-left:8em"><li class="text-primary">{{link_to_action('MaintenanceController@index', 
                            Lang::get('messages.maintenance'), array('id'=>$v->id))}}</li><br/></td>    
                    </tr>
                    <tr>
                        <td><li class="text-primary">{{ Lang::get('messages.damages') }}</li><br/></td>
                    <td style="padding-left:8em"><li class="text-primary">{{link_to_action('RepairController@problems', 
                            Lang::get('messages.problems'), array('id'=>$v->id))}}</li> </td>
                    </tr>
                    <tr>
                        <td><li class="text-primary">{{Lang::get('messages.accidents')}}</li><br/></td>
                    <td style="padding-left:8em"><li class="text-primary">{{link_to_action('RepairController@index', 
                            Lang::get('messages.repairs'), array('id'=>$v->id))}}</li></td>
                    </tr>
                    <tr>
                        <td><li class="text-primary">{{link_to_action('CarController@images_galery', 
                            Lang::get('messages.upload_images'), array('id'=>$v->id))}}</li><br/></td> 
                    <td style="padding-left:8em"><li class="text-primary">{{link_to_action('CarController@docs_galery', 
                            Lang::get('messages.upload_docs'), array('id'=>$v->id))}}</li></td>
                    </tr>
                    <tr>
                        <td><li class="text-primary">{{Lang::get('messages.vehicle_conditions')}}</li></td>
                    <td  style="padding-left:8em"><li class="text-primary">{{ Lang::get('messages.deactivate') }}</li></td>
                    </tr>                                     
                </table><br/>
                <input type="button" value="{{ Lang::get('messages.back_btn')}}" class="btn btn-danger btn-line" 
                       onClick="history.go(-1);
                               return true;">
            </ul>
        </div>
      
    </div>
    @endforeach
    @stop
